import {
	http
} from "@/utils/request.js";

import api from "@/config/api.js";

/**
 * 通过短信重置密码
 * @param  mobile
 */
export function resetByMobile(params) {
	return http.request({
		url: `/members/resetByMobile`,
		method: "POST",
		params,
	});
}

// 进度
export function speedProgress(params) {
	return http.request({
		url: `/members/revokePartnerPage`,
		method: "POST",
		needToken: true,
		params,
	});
}


export function aboutPlatform(params) {
	return http.request({
		url: `/platformAbout/getPlatformAbout`,
		method: "POST",
		data: params,
	});
}
export function getDetailform(params) {
	return http.request({
		url: `/platformAbout/getDetail`,
		method: "GET",
		params,
	});
}
/**
 * 发送验证码
 * @param  mobile
 */
export function sendMobile(mobile, type = 'LOGIN') {
	return http.request({
		url: `${api.common}/sms/${type}/${mobile}`,
		method: "GET",
	});
}

//新发送验证码
// export function sendCode(mobile) {
//   console.log(mobile)
//   return http.request({
//     url: `${api.common}/sms/${mobile}`,
//     method: "GET",
//   });
// }

export function sendCode(params) {
	return http.request({
		url: `${api.common}/sms/smsSend`,
		method: "GET",
		params,
	});
}


/**
 * 短信登录
 * @param  mobile
 * @param  smsCode
 */
export function smsLogin(params, clientType) {
	return http.request({
		url: `/members/smsLogin`,
		method: "POST",
		data: params,
		header: {
			"content-type": "application/x-www-form-urlencoded",
			clientType: clientType,
		},
	});
}

/**
 * 修改密码
 * @param  newPassword
 * @param  password
 */

export function modifyPass(params) {
	return http.request({
		url: `/members/modifyPass`,
		method: "PUT",
		params,
	});
}

/**
 * 刷新token
 */
export function refreshTokenFn(refresh_token) {
	return http.request({
		url: `/members/refresh/${refresh_token}`,
		method: "GET",
	});
}

// 获取密码状态
export function logout() {
	return http.request({
		url: '/members/logout',
		method: "POST",
		needToken: true,
	})
}
// 解析分享
export function ShareCode(id) {
	return http.request({
		url: '/extension/getShortLink',
		method: "get",
		params: {
			id
		}
	})
}
// 绑定关系
export function BindCode(){
	return http.request({
		url: '/members/bindTempEx',
		method: "get"
	})
}
